package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWmChannelClient;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CL
 * @Date: 2023-07-12   7:03
 * @Description:
 */
@RestController
@RequestMapping("/api/v1/channel/")
public class AdChannelController {

    @Autowired
    private IWmChannelClient iWmChannelClient;

    // 删除频道
    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable Integer id){
        return null;
    }

    // 根据频道名称分页模糊查询
    @PostMapping("/list")
    public ResponseResult listChannels(@RequestBody ChannelDto dto){
        return iWmChannelClient.listChannels(dto);
    }

    // 频道保存
    @PostMapping("/sava")
    public ResponseResult saveChannel(@RequestBody WmChannel wmChannel){
        return iWmChannelClient.saveChannel(wmChannel);
    }

}
